package com.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EnvoiromentController {
    @Autowired
    private Environment environment;
    @GetMapping("/port")
    public String getPort(){
        String port = environment.getProperty("server.port");
        return "启动的端口是:"+port;
    }
}
